/*
 * Passenger.java
 *
 * Created on October 3, 2007, 9:04 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package drb;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author Asger
 */
public class Passenger {
    
    public String name;
    public long cpr;
    
    /** Creates a new instance of Passenger */
    public Passenger() {
    }
    
    public Passenger(String name, long cpr)
    {
        this.name = name;
        this.cpr = cpr;
    }
    
    public boolean equals(Passenger p)
    {
        return cpr == p.cpr;
    }
    
    public String toString()
    {
        return name;
    }
    
    public static Passenger parse(ResultSet result) throws SQLException {
        Passenger p = new Passenger();
        p.name = result.getString("passenger_name");
        p.cpr = result.getLong("passenger_cpr");
        return p;
    }
}
